

// 导入books模板文件
import booksListEjs from "../views/booksList.ejs";
// 导入自己封装的Ajax
import axios from "../request/index.js";

export default async function(req, res){
    let p = req.query ? req.query.p : 1;
    //alert(p);
    // 通过axios去加载管理员信息
    const result  = await axios.get("/books?pageIndex="+p);
    console.log(result);
    res.render(booksListEjs({
        bookslist:result.data,
        page:result.page,
        totalPage:result.totalPage
    }));

    $("#titleH1").html("图书列表");
}